var sms_arr = new Array();
	sms_arr['sms_num'] = 0;
	sms_arr['friend_num'] =0;
	sms_arr['anno_num'] =0;
	sms_arr['comment_num'] =0;
	sms_arr['recom_num'] =0;
	sms_arr['buff_num'] =0;
	sms_arr['sys_num'] =0;
	sms_arr['msg_num'] =0;
	sms_arr['remsg_num'] =0;
	sms_arr['dkpnum'] =0;
	sms_arr['cartoon'] =0;
	sms_arr['fiction'] =0;
	sms_arr['subscribe'] = 0;
var new_url = "";

function upSmsCenterHtml(arr,id){
	if(arguments.length == 3){
		new_url = arguments[2];
	}
	var str = '';
		str +="  <div class=\"part-title\">";
		str +="	   <h1>消息中心</h1>";
		str +="	     <span class=\"more\"><a href=\"/~sms.index.view_send_form\" >写短消息</a></span>";
		str +="	 </div>";
		str +="	 <div class=\"message-center-content\">";
		str +="	     <ul>";
		str +="         <li><a href=\"/~sms.index.view_inbox\">短消息</a>：<span id=\"_new_pm_sms\">"+(arr['sms_num']>0?"<a href=\"/~sms.index.view_inbox\">"+arr['sms_num']+"条新</a>":arr['sms_num']+"条新")+"</span></li>";
		str +="         <li><a href=\"/~sms.system.view_inbox\">系统通知</a>：<span id=\"_new_pm_sys\">"+(arr['sys_num']>0?"<a href=\"/~sms.system.view_inbox\">"+arr['sys_num']+"条新</a>":arr['anno_num']+"条新")+"</span></li>";
//		str +="         <li><a href=\"/~sms.system.view_inbox/type/5\">好友请求</a>：<span id=\"_new_pm_fri\">"+(arr['friend_num']>0?"<a href=\"/~sms.system.view_inbox/type/5\">"+arr['friend_num']+"条新</a>":arr['friend_num']+"条新")+"</span></li>";
		str +="         <li><a href=\"/~sms.announcement.view_inbox\">官方公告</a>：<span id=\"_new_pm_ann\">"+(arr['anno_num']>0?"<a href=\"/~sms.announcement.view_inbox\">"+arr['anno_num']+"条新</a>":arr['anno_num']+"条新")+"</span></li>";
		str +="         <li><a href=\"/~sms.comment.comment_list\">评论</a>：<span id=\"_new_pm_com\">"+(arr['comment_num']>0?"<a href=\"/~sms.comment.comment_list\">"+arr['comment_num']+"条新</a>":arr['comment_num']+"条新")+"</span></li>";
		str +="         <li><a href=\"/~sms.comment.mycomment_list\">评论回复</a>：<span id=\"_new_pm_recom\">"+(arr['recom_num']>0?"<a href=\"/~sms.comment.mycomment_list\">"+arr['recom_num']+"条新</a>":arr['recom_num']+"条新")+"</span></li>";
		str +="         <li><a href=\"/~sms.comment.message_list\">留言</a>：<span id=\"_new_pm_msg\">"+(arr['msg_num']>0?"<a href=\"/~sms.comment.message_list\">"+arr['msg_num']+"条新</a>":arr['msg_num']+"条新")+"</span></li>";
		str +="         <li><a href=\"/~sms.comment.mymessage_list\">留言回复</a>：<span id=\"_new_pm_remsg\">"+(arr['remsg_num']>0?"<a href=\"/~sms.comment.mymessage_list\">"+arr['remsg_num']+"条新</a>":arr['remsg_num']+"条新")+"</span></li>";
		str +="         <li><a href=\""+(new_url?new_url:"/~sms.dkp.dkpListUid")+"\" >我的订阅</a>：<span id=\"_new_pm_dkp\">"+(arr['subscribe']>0?"<a href=\""+(new_url?new_url:"/~sms.dkp.dkpListUid")+"\" >"+arr['subscribe']+"条新</a>":arr['subscribe']+"条新")+"</span></li>";
		//str +="         <li><a href=\"/~sms.dkp.dkpListUid\">动画更新</a>：<span id=\"_new_pm_dkp\">"+(arr['anim']>0?"<a href=\"/~sms.dkp.dkpListUid\">"+arr['anim']+"条新</a>":arr['anim']+"条新")+"</span></li>";
		//str +="         <li><a href=\"/~sms.dkp.dkpListUid\">漫画更新</a>：<span id=\"_new_pm_dkp\">"+(arr['fiction']>0?"<a href=\"/~sms.dkp.dkpListUid\">"+arr['fiction']+"条新</a>":arr['fiction']+"条新")+"</span></li>";
		str +="	     </ul>";
		str +="	   <div class=\"clearfix\"></div>";
		str +="	 </div><!--message-center-content-->";
		$(id).update(str);
		
}
function getNewSmsNum(uid,id){
		var url = "/~sms.index.getNewSmsNum";
		var rnd = Math.floor(Math.random()*100+1);
		var param = "uid="+uid+"&rnd="+rnd;
		var onComplete = function(transport){
		try{
			var show = false;
			var ret = transport.responseText.evalJSON();
			if(ret.result){
				sms_arr['sms_num'] 		=	ret.data.message;
				sms_arr['friend_num'] 	= 	ret.data.friends;
				sms_arr['anno_num'] 	= 	ret.data.announcement;
				sms_arr['buff_num'] 	= 	ret.data.buff;
				sms_arr['sys_num'] 		=	ret.data.system;
				sms_arr['comment_num'] 	=	ret.data.comnum;
				sms_arr['recom_num'] 	=	ret.data.recomment;
				sms_arr['msg_num'] 		= 	ret.data.msgnum;
				sms_arr['remsg_num'] 	=	ret.data.remsgnum;
				sms_arr['dkpnum']		=	ret.data.dkpnum;
				sms_arr['cartoon']		=	ret.data.cartoon;
				sms_arr['fiction']		=	ret.data.fiction;
				sms_arr['subscribe']	=	ret.data.subscribe;
//				sms_arr['anim']			=	ret.data.anim;
//				sms_arr['fiction']		=	ret.data.fiction;
				var new_url = '';
				if(sms_arr['sms_num']>0){
					show = true;
//					url = "/~sms.index.view_inbox";
					$('cnt_new_sms').innerHTML = '('+sms_arr['sms_num']+")";
				}else if(sms_arr['friend_num']>0){
					show = true;
//					url = "/~sms.system.view_inbox/type/5";
				}else if(sms_arr['anno_num']>0){
					show = true;
//					url = "/~sms.announcement.view_inbox";
					$('cnt_new_ann').innerHTML = '('+sms_arr['anno_num']+")";
				}else if(sms_arr['sys_num']>0){
					show = true;
//					url = "/~sms.system.view_inbox";
					$('cnt_new_sys').innerHTML = '('+sms_arr['sys_num']+")";
				}else if(sms_arr['comment_num']>0){
					show = true;
//					url = "/~sms.comment.comment_list";
					$('cnt_new_com').innerHTML = '('+sms_arr['comment_num']+")";
				}else if(sms_arr['recom_num']>0){
					show = true;
//					url = "/~sms.comment.mycomment_list";
					$('cnt_new_recom').innerHTML = '('+sms_arr['recom_num']+")";
				}else if(sms_arr['msg_num']>0){
					show = true;
//					url = "/~sms.comment.message_list";
					$('cnt_new_msg').innerHTML = '('+sms_arr['msg_num']+")";
				}else if(sms_arr['remsg_num']>0){
					show = true;
//					url = "/~sms.comment.mymessage_list";
					$('cnt_new_remsg').innerHTML = '('+sms_arr['remsg_num']+")";
				}
				else if(sms_arr['subscribe']>0){
					show = true;
					new_url = "/~sms.dkp.dkpListUid";
					if(sms_arr['cartoon']>0){
						new_url = "/~sms.cartoon.cartoonListUid";
					}
					if(sms_arr['fiction']>0){
						new_url = "/~sms.fiction.fictionListUid";
					}
/*					if(ms_arr['fiction']){
						new_url = "/~sms.dkp.dkpListUid";
					}*/
					$('cnt_new_dkp').innerHTML = '('+sms_arr['subscribe']+")";
					
				}
				
				upSmsCenterHtml(sms_arr,id,new_url);
				
				if(show){
//					$('sms_link').setAttribute('href',url);
					$('new_pm_icon').show();
				}							
			}
			}catch(e){}
		};
		new Ajax.Request(url,{
			method: 'get',
			parameters: param,
//			asynchronous:false,
			onComplete: onComplete
		});
	}

